package com.googlecode.antilopebpm.definition;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "activity")
public class ActivityDefinition {

	@XmlElementRef
	protected List<TransitionDefinition> transitions = new ArrayList<TransitionDefinition>();
	@XmlElementRef
	protected List<ConfigAttributeDefinition> configAttributes = new ArrayList<ConfigAttributeDefinition>();
	@XmlElementRef
	protected List<ExtendedAttributeDefinition> extendedAttributes = new ArrayList<ExtendedAttributeDefinition>();
	@XmlAttribute(required = true)
	protected String id;
	@XmlAttribute
	protected String name;

	public List<TransitionDefinition> getTransitions() {
		return transitions;
	}

	public void setTransitions(List<TransitionDefinition> transitions) {
		this.transitions = transitions;
	}

	public List<ConfigAttributeDefinition> getConfigAttributes() {
		return configAttributes;
	}

	public void setConfigAttributes(
			List<ConfigAttributeDefinition> configAttributes) {
		this.configAttributes = configAttributes;
	}

	public List<ExtendedAttributeDefinition> getExtendedAttributes() {
		return extendedAttributes;
	}

	public void setExtendedAttributes(
			List<ExtendedAttributeDefinition> extendedAttributes) {
		this.extendedAttributes = extendedAttributes;
	}

	public String getId() {
		return id;
	}

	public void setId(String value) {
		this.id = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String value) {
		this.name = value;
	}

	// Fluent API
	// -------------------------------------------------------------------------
	public void addTransition(TransitionDefinition transition) {
		this.getTransitions().add(transition);
	}

}
